package com.px.user.mapper;

import com.px.user.entity.Sms;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.Map;

@Repository
public interface SmsMapper {

    @Select("select id,sms,valid,createTime from sms where phone=#{phone} and ifnull(valid,0)<>1 order by createTime desc limit 1")
    Sms findByPhone(String phone);

    @Update("update sms set valid=#{valid} where id=#{id}")
    void updateUsed(Map para);
}
